package com.ssm.crud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.crud.bean.Employee;
import com.ssm.crud.bean.Msg;
import com.ssm.crud.service.EmployeeService;

@Controller
public class EmployeeQueryById {

	@Autowired
	private EmployeeService employeeService;
	
	@RequestMapping(value="/qemp/{id}",method=RequestMethod.GET)
	@ResponseBody
	public Msg queryEmp(@PathVariable("id")Integer empId) {
		Employee employee = employeeService.selectByPrimaryKeyWithDept(empId);
		return Msg.success().add("emp", employee);
	}
	
}
